import sys
from PySide6.QtWidgets import QApplication
from PySide6.QtGui import QIcon
from contract_renamer.gui.contract_renamer_gui import MainWindow
from contract_renamer.config import setup_logging
from contract_renamer.resources.icons import get_app_icon
from pathlib import Path

def main():
    # 初始化日志
    setup_logging()
    
    app = QApplication(sys.argv)
    app.setWindowIcon(get_app_icon())  # 设置应用程序图标
    
    # 创建样式目录
    style_dir = Path(__file__).parent / 'styles'
    style_dir.mkdir(exist_ok=True)
    
    window = MainWindow()
    window.show()
    sys.exit(app.exec())

if __name__ == "__main__":
    main()